perm filename HF33.TEX[UHF,DEK] blob sn#841747 filedate 1987-06-16 generic text, type T, neo UTF8
% for halftones on the Imagen, each dot independent
\chardef\other=12
\font\halftone=hf300[uhf,dek]

\newif\ifshifted
\def\shift{\moveright.5em}
\def\beginhalftone{\vbox\bgroup\offinterlineskip\halftone
 \catcode`\.=\active\shiftedtrue\shift\hbox\bgroup}
{\catcode`\.=\active \gdef.{\egroup
 \ifshifted\shiftedfalse\else\shiftedtrue\shift\fi\hbox\bgroup\ignorespaces}}
\def\endhalftone{\egroup\setbox0=\lastbox\egroup}

% Example of use:
% \beginhalftone
% chars for top halfline of picture. (shifted right 4 pixels)
% chars for second halfline of picture. (not shifted right)
% chars for third halfline of picture. (shifted right 4 pixels)
% ...
% chars for bottom halfline of picture. (possibly shifted right)
% \endhalftone

% character "0" is white, and character "P" is black;
% the hf font uses 33 consecutive ASCII codes for levels 0 to 32,
% where level k is a character with k bits black in a 4x8 array.

% (the physics of the printer causes a nonlinear response to these levels)